{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   instant  yr  holiday  workingday  season_1  season_2  season_3  season_4  \\\n0        1   0        0           0         1         0         0         0   \n1        2   0        0           0         1         0         0         0   \n2        3   0        0           1         1         0         0         0   \n\n   mnth_1  mnth_2  ...  weekday_5  weekday_6  weathersit_1  weathersit_2  \\\n0       1       0  ...          0          1             0             1   \n1       1       0  ...          0          0             0             1   \n2       1       0  ...          0          0             1             0   \n\n   weathersit_3      temp     atemp       hum  windspeed   cnt  \n0             0  0.355170  0.373517  0.828620   0.284606   985  \n1             0  0.379232  0.360541  0.715771   0.466215   801  \n2             0  0.171000  0.144830  0.449638   0.465740  1349  \n\n[3 rows x 35 columns]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "import pandas as pd\n",
    "\n",
    "filename = \"out/bike_sharing/FE_day.csv\"\n",
    "FE_data = pd.read_csv(filename)\n",
    "print(FE_data.head(3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "X_train前3条数据:\n      yr  holiday  workingday  season_1  season_2  season_3  season_4  mnth_1  \\\n443   1        0           1         1         0         0         0       0   \n414   1        0           0         1         0         0         0       0   \n410   1        0           1         1         0         0         0       0   \n\n     mnth_2  mnth_3  ...  weekday_4  weekday_5  weekday_6  weathersit_1  \\\n443       0       1  ...          0          0          0             1   \n414       1       0  ...          0          0          0             0   \n410       1       0  ...          0          0          0             1   \n\n     weathersit_2  weathersit_3      temp     atemp       hum  windspeed  \n443             0             0  0.605417  0.595610  0.749357   0.288463  \n414             1             0  0.275214  0.245093  0.530420   0.475642  \n410             0             0  0.360361  0.357771  0.546272   0.328216  \n\n[3 rows x 33 columns]\n\ny_train前3条数据:\n 443    6153\n414    2689\n410    4169\nName: cnt, dtype: int64\n\nX_test前3条数据:\n      yr  holiday  workingday  season_1  season_2  season_3  season_4  mnth_1  \\\n477   1        0           0         0         1         0         0       0   \n641   1        0           1         0         0         0         1       0   \n503   1        0           1         0         1         0         0       0   \n\n     mnth_2  mnth_3  ...  weekday_4  weekday_5  weekday_6  weathersit_1  \\\n477       0       0  ...          0          0          0             0   \n641       0       0  ...          0          0          0             0   \n503       0       0  ...          0          1          0             1   \n\n     weathersit_2  weathersit_3      temp     atemp       hum  windspeed  \n477             0             1  0.420587  0.407487  0.859041   0.664138  \n641             1             0  0.745598  0.682653  0.816195   0.091026  \n503             0             0  0.629300  0.619631  0.538132   0.235894  \n\n[3 rows x 33 columns]\n\ny_test前3条数据:\n 477    1027\n641    7572\n503    7639\nName: cnt, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "# 数据的80%作为训练集,20%作为测试集\n",
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "y = FE_data[\"cnt\"]\n",
    "X = FE_data.drop([\"instant\", \"cnt\"], axis=1)\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, \n",
    "                                                    random_state=23, \n",
    "                                                    test_size=0.2)\n",
    "print(\"X_train前3条数据:\\n\", X_train.head(3))\n",
    "print(\"\\ny_train前3条数据:\\n\", y_train.head(3))\n",
    "\n",
    "print(\"\\nX_test前3条数据:\\n\", X_test.head(3))\n",
    "print(\"\\ny_test前3条数据:\\n\", y_test.head(3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Index(['yr', 'holiday', 'workingday', 'season_1', 'season_2', 'season_3',\n       'season_4', 'mnth_1', 'mnth_2', 'mnth_3', 'mnth_4', 'mnth_5', 'mnth_6',\n       'mnth_7', 'mnth_8', 'mnth_9', 'mnth_10', 'mnth_11', 'mnth_12',\n       'weekday_0', 'weekday_1', 'weekday_2', 'weekday_3', 'weekday_4',\n       'weekday_5', 'weekday_6', 'weathersit_1', 'weathersit_2',\n       'weathersit_3', 'temp', 'atemp', 'hum', 'windspeed'],\n      dtype='object')\nThe R2 score on train is: 0.850\nThe R2 score on test is: 0.786\nThe RMSE score on train is:752.469\nThe RMSE score on test is:879.671\n回归表达式系数为: [ 2.05937218e+03  9.50032712e+16  9.50032712e+16  1.36445394e+17\n  1.36445394e+17  1.36445394e+17  1.36445394e+17 -2.92636459e+16\n -2.92636459e+16 -2.92636459e+16 -2.92636459e+16 -2.92636459e+16\n -2.92636459e+16 -2.92636459e+16 -2.92636459e+16 -2.92636459e+16\n -2.92636459e+16 -2.92636459e+16 -2.92636459e+16  1.40134982e+16\n -8.09897730e+16 -8.09897730e+16 -8.09897730e+16 -8.09897730e+16\n -8.09897730e+16  1.40134982e+16  1.20473795e+17  1.20473795e+17\n  1.20473795e+17  2.96800000e+03  7.08000000e+02 -1.50400000e+03\n -1.30200000e+03]\n回归表达式截距为: -2.4166904080627584e+17\n"
     ]
    }
   ],
   "source": [
    "feature_names = X.columns\n",
    "print(feature_names)\n",
    "\n",
    "# 最小二乘线性回归\n",
    "from sklearn.linear_model import LinearRegression\n",
    "from sklearn.metrics import r2_score\n",
    "from sklearn.metrics import mean_squared_error\n",
    "\n",
    "lr = LinearRegression()\n",
    "lr.fit(X_train, y_train)\n",
    "y_train_pred = lr.predict(X_train)\n",
    "print(\"The R2 score on train is: {:.3f}\".format(r2_score(y_train, y_train_pred)))\n",
    "y_test_pred = lr.predict(X_test)\n",
    "print(\"The R2 score on test is: {:.3f}\".format(r2_score(y_test, y_test_pred)))\n",
    "\n",
    "train_rmse = np.sqrt(mean_squared_error(y_train, y_train_pred))\n",
    "print(\"The RMSE score on train is:{:.3f}\".format(train_rmse))\n",
    "test_rmse = np.sqrt(mean_squared_error(y_test, y_test_pred))\n",
    "print(\"The RMSE score on test is:{:.3f}\".format(test_rmse))\n",
    "\n",
    "print(\"回归表达式系数为:\", lr.coef_)\n",
    "print(\"回归表达式截距为:\", lr.intercept_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 画图显示训练集上的预测残差\n",
    "f, ax = plt.subplots(figsize=(40, 30))\n",
    "ax.hist(y_train - y_train_pred, bins=40, label=\"Residuals on train set\",\n",
    "        color=\"b\", alpha=.5)\n",
    "ax.set_title(\"Histogram of Residuals on train set\")\n",
    "ax.legend(loc=\"best\")\n",
    "plt.show()\n",
    "\n",
    "# 画图显示校验集上的预测残差\n",
    "f, ax = plt.subplots(figsize=(40, 30))\n",
    "ax.hist(y_test - y_test_pred, bins=40, label=\"Residuals on test set\",\n",
    "        color=\"b\", alpha=.5)\n",
    "ax.set_title(\"Histogram of Residuals on test set\")\n",
    "ax.legend(loc=\"best\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![训练集预测残差分布](https://gitee.com/coolhenry/week_4__machine_learning/raw/master/out/bike_sharing/residuals_train_linear.jpg)\n",
    "![校验集预测残差分布](https://gitee.com/coolhenry/week_4__machine_learning/raw/master/out/bike_sharing/residuals_test_linear.jpg)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The R2 score on train is:0.858\nThe R2 score on test is:0.798\nThe RMSE score on train is:732.552\nThe RMSE score on test is: 855.030\n训练集的长度: 584\nridge的cv_values_的长度:584\nridge的cv_values_值如下:\n [[1.16941668e+06 1.17533826e+06 1.23349287e+06 1.72900209e+06\n  2.75951040e+06]\n [1.11635194e+05 1.06840020e+05 9.06917381e+04 9.20962797e+04\n  4.17887564e+05]\n [4.16550254e+04 4.10871760e+04 3.41188146e+04 1.09528746e+04\n  7.13191870e+02]\n ...\n [2.13153971e+05 2.12384382e+05 2.12477397e+05 2.96952459e+05\n  1.21289663e+06]\n [2.38223119e+04 2.19607180e+04 8.47027630e+03 3.40250304e+04\n  1.24701637e+06]\n [8.68402877e+05 8.66996621e+05 8.49387901e+05 9.27602617e+05\n  2.69234324e+06]]\n\nridge的表达式系数如下:\n [ 2058.65385432  -516.04258603   250.90111029  -958.63759465\n   138.44356047    86.65888319   733.53515098  -320.78422036\n  -138.10866651   183.18764047    17.47360236   289.65892573\n   178.97106166  -335.82067308   126.3554897    697.46075331\n   149.67386655  -382.13327874  -465.93450109   -99.49783131\n  -170.66294313   -87.15580401   -12.44911714   -11.18798143\n    16.31436998   364.63930705   860.17728328   312.76825812\n -1172.9455414   1801.70092475  1534.63452212 -1304.03720944\n -1212.07322539]\nridge的截距值为: 2198.553829688799\n"
     ]
    }
   ],
   "source": [
    "# 岭回归\n",
    "from sklearn.linear_model import RidgeCV\n",
    "from sklearn.metrics import r2_score\n",
    "from sklearn.metrics import mean_squared_error\n",
    "\n",
    "alphas = [0.01, 0.1, 1, 10, 100]\n",
    "ridge = RidgeCV(alphas=alphas, store_cv_values=True)\n",
    "ridge.fit(X_train, y_train)\n",
    "y_train_pred = ridge.predict(X_train)\n",
    "print(\"The R2 score on train is:{:.3f}\".format(r2_score(y_train, y_train_pred)))\n",
    "y_test_pred = ridge.predict(X_test)\n",
    "print(\"The R2 score on test is:{:.3f}\".format(r2_score(y_test, y_test_pred)))\n",
    "\n",
    "train_rmse = np.sqrt(mean_squared_error(y_train, y_train_pred))\n",
    "print(\"The RMSE score on train is:{:.3f}\".format(train_rmse))\n",
    "test_rmse = np.sqrt(mean_squared_error(y_test, y_test_pred))\n",
    "print(\"The RMSE score on test is: {:.3f}\".format(test_rmse))\n",
    "\n",
    "print(\"训练集的长度:\", len(X_train))\n",
    "print(\"ridge的cv_values_的长度:{}\".format(len(ridge.cv_values_)))\n",
    "print(\"ridge的cv_values_值如下:\\n\", ridge.cv_values_)\n",
    "\n",
    "print(\"\")\n",
    "\n",
    "print(\"ridge的表达式系数如下:\\n\", ridge.coef_)\n",
    "print(\"ridge的截距值为:\", ridge.intercept_)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 画图显示训练集上的拟合情况\n",
    "plt.rcParams[\"font.sans-serif\"] = [\"SimHei\"]\n",
    "plt.rcParams[\"axes.unicode_minus\"] = False\n",
    "sns.scatterplot(y_train, y_train_pred)\n",
    "plt.title(\"训练集真实值和预测值的关系\")\n",
    "plt.xlabel(\"训练集-真实值\")\n",
    "plt.ylabel(\"训练集-预测值\")\n",
    "plt.show()\n",
    "\n",
    "# 画图显示训练集上的拟合误差分布\n",
    "y_train_residual = y_train - y_train_pred\n",
    "sns.distplot(y_train_residual, bins=40)\n",
    "plt.title(\"训练集上的预测残差分布\")\n",
    "plt.xlabel(\"训练集预测残差\")\n",
    "plt.ylabel(\"概率密度\")\n",
    "plt.show()\n",
    "\n",
    "\n",
    "# 画图显示校验集上的拟合情况\n",
    "sns.scatterplot(y_test, y_test_pred)\n",
    "plt.title(\"校验集真实值和预测值的关系\")\n",
    "plt.xlabel(\"校验集-真实值\")\n",
    "plt.ylabel(\"校验集-预测值\")\n",
    "plt.show()\n",
    "\n",
    "# 画图显示校验集上的拟合误差分布\n",
    "y_test_residual = y_test - y_test_pred\n",
    "sns.distplot(y_test_residual, bins=40)\n",
    "plt.title(\"校验集上的预测残差分布\")\n",
    "plt.xlabel(\"校验集预测残差\")\n",
    "plt.ylabel(\"概率密度\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "结果图:\n",
    "![训练集真实值和预测值](https://gitee.com/coolhenry/week_4__machine_learning/raw/master/out/bike_sharing/train_pred_ridgecv.png)\n",
    "![训练集残差分布](https://gitee.com/coolhenry/week_4__machine_learning/raw/master/out/bike_sharing/residuals_train_ridgecv.png)\n",
    "\n",
    "![校验集真实值和预测值](https://gitee.com/coolhenry/week_4__machine_learning/raw/master/out/bike_sharing/test_pred_ridgecv.png)\n",
    "![校验集残差分布](https://gitee.com/coolhenry/week_4__machine_learning/raw/master/out/bike_sharing/residuals_test_ridgecv.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The R2 score on train is:0.858\nThe R2 score on test is:0.797\nThe RMSE score on train is:731.451\nThe RMSE score on test is:858.630\nLasso的表达式系数值为: [ 2.05331586e+03 -7.27113751e+02  5.86061906e+01 -1.24611998e+03\n -1.35234168e+02 -2.43502025e+02  4.81352123e+02 -2.24869942e+02\n -5.99042119e+01  1.94946645e+02 -0.00000000e+00  2.04149774e+02\n  4.04847397e+01 -4.56692162e+02  2.36780750e+00  6.41193744e+02\n  9.27530403e+01 -3.71244482e+02 -4.18444880e+02 -2.66373107e+02\n -1.41659522e+02 -6.21612323e+01  0.00000000e+00  0.00000000e+00\n  1.92954520e+01  1.92382217e+02  5.63980132e+02  4.73886816e+01\n -1.46313342e+03  3.24643046e+03  4.40105575e+02 -1.47666910e+03\n -1.32784099e+03]\nLasso的表达式的截距值为: 2912.1989575693706\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\python3\\lib\\site-packages\\sklearn\\model_selection\\_split.py:1978: FutureWarning: The default value of cv will change from 3 to 5 in version 0.22. Specify it explicitly to silence this warning.\n  warnings.warn(CV_WARNING, FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "# Lasso回归\n",
    "from sklearn.linear_model import LassoCV\n",
    "from sklearn.metrics import r2_score\n",
    "from sklearn.metrics import mean_squared_error\n",
    "\n",
    "alphas = [0.01, 0.1, 1, 10, 100]\n",
    "lasso = LassoCV(alphas=alphas, tol=1e-2)\n",
    "lasso.fit(X_train, y_train)\n",
    "y_train_pred = lasso.predict(X_train)\n",
    "y_test_pred = lasso.predict(X_test)\n",
    "\n",
    "# 训练集上的R2 Score\n",
    "train_r2_score = r2_score(y_train, y_train_pred)\n",
    "print(\"The R2 score on train is:{:.3f}\".format(train_r2_score))\n",
    "# 测试集上的R2 Score\n",
    "test_r2_score = r2_score(y_test, y_test_pred)\n",
    "print(\"The R2 score on test is:{:.3f}\".format(test_r2_score))\n",
    "\n",
    "# 训练集上的RMSE Score\n",
    "train_rmse = np.sqrt(mean_squared_error(y_train, y_train_pred))\n",
    "print(\"The RMSE score on train is:{:.3f}\".format(train_rmse))\n",
    "# 测试集上的RMSE Score\n",
    "test_rmse = np.sqrt(mean_squared_error(y_test, y_test_pred))\n",
    "print(\"The RMSE score on test is:{:.3f}\".format(test_rmse))\n",
    "\n",
    "print(\"Lasso的表达式系数值为:\", lasso.coef_)\n",
    "print(\"Lasso的表达式的截距值为:\", lasso.intercept_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 画图显示训练集上的拟合情况\n",
    "plt.rcParams[\"font.sans-serif\"] = [\"SimHei\"]\n",
    "plt.rcParams[\"axes.unicode_minus\"] = False\n",
    "sns.scatterplot(y_train, y_train_pred)\n",
    "plt.title(\"训练集上的拟合情况\")\n",
    "plt.xlabel(\"训练集-真实值\")\n",
    "plt.ylabel(\"训练集-预测值\")\n",
    "plt.show()\n",
    "\n",
    "# 画图显示训练集上的预测残差分布\n",
    "y_train_residual = y_train - y_train_pred\n",
    "sns.distplot(y_train_residual, bins=40)\n",
    "plt.title(\"训练集上的预测残差分布\")\n",
    "plt.xlabel(\"预测残差\")\n",
    "plt.ylabel(\"概率密度\")\n",
    "plt.show()\n",
    "\n",
    "# 画图显示校验集上的拟合情况\n",
    "sns.scatterplot(y_test, y_test_pred)\n",
    "plt.title(\"校验集上的拟合情况\")\n",
    "plt.xlabel(\"校验集-真实值\")\n",
    "plt.ylabel(\"校验集-预测值\")\n",
    "plt.show()\n",
    "\n",
    "# 画图显示校验集上的预测残差分布\n",
    "y_test_residual = y_test - y_test_pred\n",
    "sns.distplot(y_test_residual, bins=40)\n",
    "plt.title(\"校验集上的预测残差分布\")\n",
    "plt.xlabel(\"预测残差\")\n",
    "plt.ylabel(\"概率密度\")\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "结果图:\n",
    "![训练集真实值和预测值](https://gitee.com/coolhenry/week_4__machine_learning/raw/master/out/bike_sharing/train_pred_lassocv.png)\n",
    "![训练集残差分布](https://gitee.com/coolhenry/week_4__machine_learning/raw/master/out/bike_sharing/residuals_train_lassocv.png)\n",
    "\n",
    "![校验集真实值和预测值](https://gitee.com/coolhenry/week_4__machine_learning/raw/master/out/bike_sharing/test_pred_lassocv.png)\n",
    "![校验集残差分布](https://gitee.com/coolhenry/week_4__machine_learning/raw/master/out/bike_sharing/residuals_test_lassocv.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 不同回归方法，在校验集上的表现对比\n",
    "|  | R2 Score | RMSE |\n",
    "| ---- | ---- | ---- |\n",
    "| 最小二乘 | 0.786 | 879.671 |\n",
    "| RidgeCV | 0.798 | 855.030 |\n",
    "| LassoCV | 0.797 | 858.630 |\n",
    "\n",
    "#### 不同回归方法，在训练集上的表现对比\n",
    "| | R2 Score | RMSE |\n",
    "| ---- | ---- | ---- |\n",
    "| 最小二乘 | 0.850 | 752.469 |\n",
    "| RidgeCV | 0.858 | 732.552 |\n",
    "| LassoCV | 0.858 | 731.451 |\n",
    "\n",
    "#### 从结果可以看出\n",
    "+ 在校验集上的结果RidgeCV和LassoCV相当，好于最小二乘\n",
    "+ 在训练集上的结果三者接近\n",
    "+ 所以加了正则项之后，泛化能力有所提高。\n",
    "\n",
    "#### 不同回归方法，得到的特征系数值\n",
    "+ 最小二乘 回归表达式系数为: [ 2.05937218e+03  9.50032712e+16  9.50032712e+16  1.36445394e+17\n",
    "  1.36445394e+17  1.36445394e+17  1.36445394e+17 -2.92636459e+16\n",
    " -2.92636459e+16 -2.92636459e+16 -2.92636459e+16 -2.92636459e+16\n",
    " -2.92636459e+16 -2.92636459e+16 -2.92636459e+16 -2.92636459e+16\n",
    " -2.92636459e+16 -2.92636459e+16 -2.92636459e+16  1.40134982e+16\n",
    " -8.09897730e+16 -8.09897730e+16 -8.09897730e+16 -8.09897730e+16\n",
    " -8.09897730e+16  1.40134982e+16  1.20473795e+17  1.20473795e+17\n",
    "  1.20473795e+17  2.96800000e+03  7.08000000e+02 -1.50400000e+03\n",
    " -1.30200000e+03]\n",
    "+ RidgeCV 回归的表达式系数如下:\n",
    " [ 2058.65385432  -516.04258603   250.90111029  -958.63759465\n",
    "   138.44356047    86.65888319   733.53515098  -320.78422036\n",
    "  -138.10866651   183.18764047    17.47360236   289.65892573\n",
    "   178.97106166  -335.82067308   126.3554897    697.46075331\n",
    "   149.67386655  -382.13327874  -465.93450109   -99.49783131\n",
    "  -170.66294313   -87.15580401   -12.44911714   -11.18798143\n",
    "    16.31436998   364.63930705   860.17728328   312.76825812\n",
    " -1172.9455414   1801.70092475  1534.63452212 -1304.03720944\n",
    " -1212.07322539]\n",
    "+ LassoCV 回归的表达式系数如下:\n",
    "[ 2.05331586e+03 -7.27113751e+02  5.86061906e+01 -1.24611998e+03\n",
    " -1.35234168e+02 -2.43502025e+02  4.81352123e+02 -2.24869942e+02\n",
    " -5.99042119e+01  1.94946645e+02 -0.00000000e+00  2.04149774e+02\n",
    "  4.04847397e+01 -4.56692162e+02  2.36780750e+00  6.41193744e+02\n",
    "  9.27530403e+01 -3.71244482e+02 -4.18444880e+02 -2.66373107e+02\n",
    " -1.41659522e+02 -6.21612323e+01  0.00000000e+00  0.00000000e+00\n",
    "  1.92954520e+01  1.92382217e+02  5.63980132e+02  4.73886816e+01\n",
    " -1.46313342e+03  3.24643046e+03  4.40105575e+02 -1.47666910e+03\n",
    " -1.32784099e+03]\n",
    "\n",
    "+ 可以看出，最小二乘的特征系数绝对值最大，RidgeCV和LassoCV的特征系数绝对值较小；这说明L2正则项和L1正则项都起到了收缩系数的作用，进而降低了模型的复杂度；\n",
    "+ LassoCV的特征系数存在一些趋近于0的值，说明它对于强特征有一些选择性，容易得出较为稀疏的结果；\n",
    "+ RidgeCV的特征系数绝对值都大于0，有些系数虽然较小，但仍然没有降低到0，说明RidgeCV能调和各个特征的影响程度，得出一个较均匀的结果。 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
